using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace WpfCardGame.ViewModel
{
    /// <summary>
    /// This class contains properties that the main View can data bind to.
    /// <para>
    /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
    /// </para>
    /// <para>
    /// You can also use Blend to data bind with the tool's support.
    /// </para>
    /// <para>
    /// See http://www.galasoft.ch/mvvm
    /// </para>
    /// </summary>
    public class MainViewModel : ViewModelBase
    {

        private bool showBJView = false;
        public bool ShowBJView
        {
            get
            {
                return showBJView;
            }
            set
            {
                showBJView = value;
                RaisePropertyChanged(() => ShowBJView);
            }
        }

        private bool showWarView = false;
        public bool ShowWarView
        {
            get
            {
                return showWarView;
            }
            set
            {
                showWarView = value;
                RaisePropertyChanged(() => ShowWarView);
            }
        }

        private bool showPokerView = false;
        public bool ShowPokerView
        {
            get
            {
                return showPokerView;
            }
            set
            {
                showPokerView = value;
                RaisePropertyChanged(() => ShowPokerView);
            }
        }

        private string game;
        public string Game
        {
            get
            {
                return game;
            }
            set
            {
                game = value;
                RaisePropertyChanged(() => Game);
            }
        }

        private RelayCommand<string> _ChangeCommand;
        public RelayCommand<string> ChangeCommand
        {
            get
            {
                if (_ChangeCommand == null)
                {
                    _ChangeCommand = new RelayCommand<string>(
                        (p) => ChangeView(p),
                        (p) => true);
                }

                return _ChangeCommand;
            }

        }

        public void ChangeView(string View)
        {
            if (View == "BJ")
            {
                Game = "BlackJack";
                ShowBJView = true;
                ShowPokerView = false;
                ShowWarView = false;
            }
            else if (View == "Poker")
            {
                Game = "Poker";
                ShowBJView = false;
                ShowPokerView = true;
                ShowWarView = false;
            }
            else if (View == "War")
            {
                Game = "War";
                ShowBJView = false;
                ShowPokerView = false;
                ShowWarView = true;
            }
        }

        public MainViewModel()
        {
        }

    }
}